<!-- inc:inc.head -->
<div class="h70"></div>
<div class="list_msg_menu">
	<div class="list_msg_return" onclick="javascript:history.back(-1);"><i class="iconfont icon-fanhui"></i></div>
    <div class="list_msg_subnav"><a href="login.php?act=logout"><i class="iconfont icon-tuichu"></i></a></div>

    <!--if($msg_info)-->
    修改文章
    <!--else-->
    发布文章
    <!--end-->
</div>
<div class="i_news_warp mt20">
	<div class="mwarp90">
    	<div class="h20"></div>
        
    <form method="post" action="my.php?act=addok" onsubmit="return add_chk(this);" enctype="multipart/form-data">
           <input name="id" value="{:$msg_info['id']}" type="hidden">
       <input name="insert_id" value="{:$msg_info['thumb']}" type="hidden">
       
       
        <div class="book_input">
          <div>标题 <span style="color:red;">*</span></div>
          <p><input type="text" name="title" id="title" class="ginput" value="{:$msg_info[subject]}" /></p>
        </div>
        
        
        <div class="book_input">
          <div>分类 <span style="color:red;">*</span></div>
          <p><select name="cateid" id="cateid" onchange="changese(this)"  class="ginput">
                <!--<option value="0">选择分类...</option>-->
                <!-- $msg_cat_list AS $key=>$value -->
                <option value="{:$value[id]}" {if($msg_info[cateid] == $value[id])} selected{end}>{:$value[space]}{:$value[catename]}</option>
                <!-- end -->
            </select></p>
        </div>
        
        
            
        	 <div class="mb20 login_div" style="display:none;"><i class="iconfont icon-useron fl"></i>
            <!-- 图标暂时屏蔽 --> <input class="ginput" type="file" name="filename" id="filename" /></p>
            <!--if($msg_images)-->
            <img src="{:$msg_images['folder']}{:$msg_images['filename']}" style="width: 50px;"/>
            <!--end--></div>
            
            

        	 <div class="mb20 login_div">
            <link href="summernote/summernote-lite.css" rel="stylesheet">
    <script src="summernote/summernote-lite.js"></script>
<script src="summernote/lang/summernote-zh-CN.js"></script>
<textarea id="content" name="content">{:$msg_content[content]}</textarea>
 
<script type="text/javascript">
    //调用富文本编辑
    $(document).ready(function() {
        var $summernote = $('#content').summernote({
            height: 200,
            focus: true,
			tooltip:false,
			lang: 'zh-CN',
			toolbar: [
			   ['style', ['bold', 'italic', 'underline', 'clear']],
			   ['fontsize', ['fontsize']],
			   ['color', ['color']],
			   ['para', ['paragraph']],
			   ['insert', ['picture']]
			  ],
            callbacks: {
                onImageUpload: function (files) {
                    sendFile($summernote, files[0]);
                }
            }
        });

        function sendFile($summernote, file) {
            var formData = new FormData();
            formData.append("file", file);
            $.ajax({
                url: "my.php?act=uploadimg",//路径是你控制器中上传图片的方法，下面controller里面我会写到
                data: formData,
                cache: false,
                dataType:"json",
                contentType: false,
                processData: false,
                type: 'POST',
                success: function (res) {

                    if(res.status==1){
                        $summernote.summernote('insertImage',  res.url, function ($image) {
                            $image.attr('src', res.url);
                        });
                    }else{
                        alert(res.msg);
                    }



//                    $summernote.summernote('insertImage', data, function ($image) {
//                        $image.attr('src', data);
//                    });
                }
            });
        }
    });
</script>

</div>
            <div><input name="submit" type="submit" class="l_btn" id="submit" value="{:lan('cn'=>'提交','en'=>'Submit')}"></div><br  />
    </form>
    
   </div>
</div>



<!-- inc:inc.footer -->